import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: [
      {
        find: '@',
        replacement: resolve(__dirname, 'src')
      },
      {
        find: '@router',
        replacement: resolve(__dirname, 'src/router')
      }
    ]
  },
  // base: process.env.NODE_ENV === 'production' ? './' : '/',
  server: {
    host: '0.0.0.0',
    open: true
  },
  build: {
    minify: 'terser',
    terserOptions: {
      compress: {
        //生产环境时移除console
        drop_console: false,
        drop_debugger: true
      }
    }
  },
  css: {
    // css预处理器
    preprocessorOptions: {
      less: {
        charset: false,
        additionalData:
          '@import "./src/assets/styles/mixins.less";@import "./src/assets/styles/variables.less";'
      }
    }
  }
})
